<html>

<head>

<?php

include "../includes/constants.php";
include "../includes/db_schema.php";
	CreateTableSchema(npc_types);

function SimpleNPCtd($FieldNum,$DisplayName="",$InputSize="1") {
	global $Schema;
	$FieldName = $Schema["npc_types"][$FieldNum]["COLUMN_NAME"];
	if ($DisplayName == "") {$DisplayName = ucfirst($FieldName);};
	echo "\t\t<td title=\"" . $FieldName . "\">" . $DisplayName . "</td>
		<td title=\"" . $FieldName . " value\"><input type=\"text\" size=\"" . $InputSize . "\" name=\"" . $FieldNum . "\" value=\"" . $DefaultValue . "\"></td>\n";
};

function SimpleNPCtext($FieldNum,$DisplayName="",$InputSize="1") {
	global $Schema;
	$FieldName = $Schema["npc_types"][$FieldNum]["COLUMN_NAME"];
	if ($DisplayName == "") {$DisplayName = ucfirst($FieldName);};
	echo $DisplayName . ": <input type=\"text\" size=\"" . $InputSize . "\" name=\"" . $FieldNum . "\" value=\"" . $DefaultValue . "\">\n";
};

?>

<title>EQ Emu - Add NPC</title>

</head>

<body>

<?php

if ($_POST) {
	$query_post = "INSERT INTO npc_types SET ";
	foreach ($Schema["npc_types"] as $Key => $Value) {
		if (isset($_POST[$Key])) {
			$query_post .= $Value . "='" . $_POST[$Key] . "', ";
		};
	};

	echo $query_post . "<br>\n";
//	mysql_query($query_post,$db);
};

?>

<form method="POST" action="">

<button type="submit">Add</button>
<button type="reset">Clear</button>

<table border="0">
	<tr>
<?php SimpleNPCtd(0,'ID',3);?>
	</tr>
	<tr>
<?php SimpleNPCtd(1,'',32);?>
	</tr>
	<tr>
<?php SimpleNPCtd(2,'',32);?>
	</tr>
	<tr>
<?php SimpleNPCtd(3);?>
	</tr>
	<tr>
<?php SimpleNPCtd(4);?>
	</tr>
	<tr>
<?php SimpleNPCtd(5);?>
	</tr>
	<tr>
<?php SimpleNPCtd(6);?>
	</tr>
	<tr>
<?php SimpleNPCtd(8);?>
	</tr>
	<tr>
<?php SimpleNPCtd(9);?>
	</tr>
	<tr>
<?php SimpleNPCtd(10);?>
	</tr>
	<tr>
<?php SimpleNPCtd(11);?>
	</tr>
	<tr>
<?php SimpleNPCtd(14);?>
	</tr>
	<tr>
<?php SimpleNPCtd(15);?>
	</tr>
	<tr>
<?php SimpleNPCtd(16);?>
	</tr>
	<tr>
<?php SimpleNPCtd(17);?>
	</tr>
	<tr>
<?php SimpleNPCtd(18);?>
	</tr>
	<tr>
<?php SimpleNPCtd(19);?>
	</tr>
	<tr>
<?php SimpleNPCtd(20);?>
	</tr>
	<tr>
<?php SimpleNPCtd(21);?>
	</tr>
	<tr>
<?php SimpleNPCtd(22);?>
	</tr>
	<tr>
<?php SimpleNPCtd(23);?>
	</tr>
	<tr>
<?php SimpleNPCtd(24);?>
	</tr>
	<tr>
<?php SimpleNPCtd(25);?>
	</tr>
	<tr>
<?php SimpleNPCtd(26);?>
	</tr>
	<tr>
<?php SimpleNPCtd(27);?>
	</tr>
	<tr>
<?php SimpleNPCtd(28);?>
	</tr>
	<tr>
<?php SimpleNPCtd(29);?>
	</tr>
	<tr>
<?php SimpleNPCtd(30);?>
	</tr>
	<tr>
<?php SimpleNPCtd(31);?>
	</tr>
	<tr>
<?php SimpleNPCtd(37);?>
	</tr>
	<tr>
<?php SimpleNPCtd(38);?>
	</tr>
	<tr>
<?php SimpleNPCtd(39);?>
	</tr>
	<tr>
<?php SimpleNPCtd(41);?>
	</tr>
	<tr>
<?php SimpleNPCtd(42);?>
	</tr>
	<tr>
<?php SimpleNPCtd(43);?>
	</tr>
	<tr>
<?php SimpleNPCtd(44);?>
	</tr>
	<tr>
<?php SimpleNPCtd(7,'HP');?>
	</tr>
	<tr>
		<td>Regen</td>
		<td>
<?php SimpleNPCtext(12,'HP');?>
<?php SimpleNPCtext(13,'Mana');?>
		</td>
	</tr>
	<tr>
<?php SimpleNPCtd(40);?>
	</tr>
	<tr>
		<td>Base Stats</td>
		<td>
<?php SimpleNPCtext(45);?>
<?php SimpleNPCtext(46);?>
<?php SimpleNPCtext(47);?>
<?php SimpleNPCtext(48);?>
<?php SimpleNPCtext(49,'INT');?>
<?php SimpleNPCtext(50);?>
<?php SimpleNPCtext(51);?>
		</td>
	</tr>
	<tr>
		<td>Resists</td>
		<td>
<?php SimpleNPCtext(32);?>
<?php SimpleNPCtext(33);?>
<?php SimpleNPCtext(34);?>
<?php SimpleNPCtext(35);?>
<?php SimpleNPCtext(36);?>
		</td>
	</tr>
	<tr>
<?php SimpleNPCtd(52);?>
	</tr>
	<tr>
<?php SimpleNPCtd(53);?>
	</tr>
	<tr>
<?php SimpleNPCtd(54);?>
	</tr>
</table>

<button type="submit">Add</button>
<button type="reset">Clear</button>

</form>

</body>

</html>